package nrtech.br.com.angel.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.IdentityScopeType;

import nrtech.br.com.angel.dao.AgenciaDao;
import nrtech.br.com.angel.dao.BancoDao;
import nrtech.br.com.angel.dao.CartaoDao;
import nrtech.br.com.angel.dao.ConfigDao;
import nrtech.br.com.angel.dao.ContaBancoDao;
import nrtech.br.com.angel.dao.CotacaoDao;
import nrtech.br.com.angel.dao.DocumentoDao;
import nrtech.br.com.angel.dao.FonteDao;
import nrtech.br.com.angel.dao.FontesFormasPagtoDao;
import nrtech.br.com.angel.dao.FormaPagtoDao;
import nrtech.br.com.angel.dao.GrupoLanctoDao;
import nrtech.br.com.angel.dao.HistCartaoDao;
import nrtech.br.com.angel.dao.InvestimentoDao;
import nrtech.br.com.angel.dao.LancamentoDao;
import nrtech.br.com.angel.dao.TipoLancamentoDao;
import nrtech.br.com.angel.dao.TipoDoctoDao;
import nrtech.br.com.angel.dao.TitularesDao;
import nrtech.br.com.angel.dao.AlarmeDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 3): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 3;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
        AgenciaDao.createTable(db, ifNotExists);
        BancoDao.createTable(db, ifNotExists);
        CartaoDao.createTable(db, ifNotExists);
        ConfigDao.createTable(db, ifNotExists);
        ContaBancoDao.createTable(db, ifNotExists);
        CotacaoDao.createTable(db, ifNotExists);
        DocumentoDao.createTable(db, ifNotExists);
        FonteDao.createTable(db, ifNotExists);
        FontesFormasPagtoDao.createTable(db, ifNotExists);
        FormaPagtoDao.createTable(db, ifNotExists);
        GrupoLanctoDao.createTable(db, ifNotExists);
        HistCartaoDao.createTable(db, ifNotExists);
        InvestimentoDao.createTable(db, ifNotExists);
        LancamentoDao.createTable(db, ifNotExists);
        TipoLancamentoDao.createTable(db, ifNotExists);
        TipoDoctoDao.createTable(db, ifNotExists);
        TitularesDao.createTable(db, ifNotExists);
        AlarmeDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
        AgenciaDao.dropTable(db, ifExists);
        BancoDao.dropTable(db, ifExists);
        CartaoDao.dropTable(db, ifExists);
        ConfigDao.dropTable(db, ifExists);
        ContaBancoDao.dropTable(db, ifExists);
        CotacaoDao.dropTable(db, ifExists);
        DocumentoDao.dropTable(db, ifExists);
        FonteDao.dropTable(db, ifExists);
        FontesFormasPagtoDao.dropTable(db, ifExists);
        FormaPagtoDao.dropTable(db, ifExists);
        GrupoLanctoDao.dropTable(db, ifExists);
        HistCartaoDao.dropTable(db, ifExists);
        InvestimentoDao.dropTable(db, ifExists);
        LancamentoDao.dropTable(db, ifExists);
        TipoLancamentoDao.dropTable(db, ifExists);
        TipoDoctoDao.dropTable(db, ifExists);
        TitularesDao.dropTable(db, ifExists);
        AlarmeDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends SQLiteOpenHelper {

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(AgenciaDao.class);
        registerDaoClass(BancoDao.class);
        registerDaoClass(CartaoDao.class);
        registerDaoClass(ConfigDao.class);
        registerDaoClass(ContaBancoDao.class);
        registerDaoClass(CotacaoDao.class);
        registerDaoClass(DocumentoDao.class);
        registerDaoClass(FonteDao.class);
        registerDaoClass(FontesFormasPagtoDao.class);
        registerDaoClass(FormaPagtoDao.class);
        registerDaoClass(GrupoLanctoDao.class);
        registerDaoClass(HistCartaoDao.class);
        registerDaoClass(InvestimentoDao.class);
        registerDaoClass(LancamentoDao.class);
        registerDaoClass(TipoLancamentoDao.class);
        registerDaoClass(TipoDoctoDao.class);
        registerDaoClass(TitularesDao.class);
        registerDaoClass(AlarmeDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}
